/* This code is currently just a copy-n-paste from the Digital Mars DLL example
 * code at http://www.digitalmars.com/d/dll.html */
module os.dll;

private import os.library;
private import std.c.windows.windows;

HINSTANCE g_hInst;

extern (Windows)
BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
{
  switch (ulReason)
  {
    case DLL_PROCESS_ATTACH:
      d_init();
      break;

    case DLL_PROCESS_DETACH:
      d_fini();
      break;

    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
      // Multiple threads not supported yet
      return false;
  }
  g_hInst=hInstance;
  return true;
}
